#ifndef Matrix_H
#define Matrix_H



#include <vector>
using namespace std;

template<typename Object>
class Matrix{
private:
	vector<vector<Object>> array;
public:
	Matrix(int rows, int cols):array(rows){
		for(int i = 0; i < rows; i++)
			array[i].resize(cols);
	}
	int rows() const {
		return array.size();
	}
	int columns() const{
		return rows() ? array[0].size():0;
	}
	const vector<Object>& operator[](int row) const{
		return array[row];
	}
	vector<Object>& operator[](int row){
		return array[row];
	}
	friend ostream& operator<<(ostream &os,const Matrix& m){
		for(int i = 0; i < m.rows(); i++)
			for(int j = 0 ; j < m.columns(); j++){
				os<<m[i][j]<<" ";
			}
		return os;
	}
};
#endif 